/*
 * gnome-gmail-notifier: the gnome gmail notifier.
 * Copyright (C) 2007 Bradley A. Worley.
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the
 * 
 *     Free Software Foundation, Inc.
 *     59 Temple Place, Suite 330
 *     Boston, MA 02111-1307 USA
 */

/*
 * ensure this is a once-only header.
 */
#ifndef __GNOME_GMAIL_NOTIFIER_PREFERENCES_H__
#define __GNOME_GMAIL_NOTIFIER_PREFERENCES_H__

/*
 * our header is just beginning.
 */
G_BEGIN_DECLS

/*
 * gconf preference keys.
 */
#define GGN_GPREF_GLOBAL_ROOT       "/apps/gnome-gmail-notifier/global"
#define GGN_GPREF_ACCOUNT_ROOT      "/apps/gnome-gmail-notifier/accounts"
#define GGN_GPREF_NOTIFY_NEW        GGN_GPREF_GLOBAL_ROOT "/notify_new"
#define GGN_GPREF_NOTIFY_ERR        GGN_GPREF_GLOBAL_ROOT "/notify_err"
#define GGN_GPREF_SOUND_ENAB        GGN_GPREF_GLOBAL_ROOT "/sound_enab"
#define GGN_GPREF_SOUND_FILE        GGN_GPREF_GLOBAL_ROOT "/sound_file"
#define GGN_GPREF_CHECKRATE         GGN_GPREF_GLOBAL_ROOT "/checkrate"
#define GGN_GPREF_FIRSTRUN          GGN_GPREF_GLOBAL_ROOT "/firstrun"
#define GGN_GPREF_ACCOUNT_LIST      GGN_GPREF_GLOBAL_ROOT "/account_list"

/*
 * default sound file.
 */
#define GGN_DEFAULT_SOUND_FILE    "/usr/share/sounds/pop.wav"

/*
 * object function macros.
 */
#define GGN_TYPE_PREFERENCES (ggn_preferences_get_type ())
#define GGN_PREFERENCES(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GGN_TYPE_PREFERENCES, GgnPreferences))
#define GGN_PREFERENCES_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GGN_TYPE_PREFERENCES, GgnPreferencesClass))
#define GGN_IS_PREFERENCES(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GGN_TYPE_PREFERENCES))
#define GGN_IS_PREFERENCES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GGN_TYPE_PREFERENCES))
#define GGN_PREFERENCES_GET_CLASS(obj)  (G_TYPE_CHECK_CLASS_CAST ((obj), GGN_TYPE_PREFERENCES, GgnPreferencesClass))

/*
 * type macros.
 */
typedef struct _GgnAccount GgnAccount;
typedef struct _GgnPreferences GgnPreferences;
typedef struct _GgnPreferencesClass GgnPreferencesClass;
typedef struct _GgnPreferencesPrivate GgnPreferencesPrivate;

/*
 * account information struct.
 */
struct _GgnAccount {
    /* a descriptive name for the account. */
    gchar* name;

    /* login information for the account. */
    gchar* user;
    gchar* domain;
    gchar* pass;

    /* is checking enabled, and is this default? */
    gboolean enab;
    gboolean send;
};

/*
 * object definition.
 */
struct _GgnPreferences {
    /* parent gobject class. */
    GObject parent_object;
    
    /* private instance members. */
    GgnPreferencesPrivate* priv;
};

/*
 * class definition.
 */
struct _GgnPreferencesClass {
    /* parent gobject class. */
    GObjectClass parent;
    
    /* signal definitions. */
    void (*accounts_modified) (GgnPreferences* prefs);
};

/*
 * gobject-type definition.
 */
GType ggn_preferences_get_type (void);

/*
 * object creation functions.
 */
GgnPreferences* ggn_preferences_new (void);
void ggn_preferences_free (GgnPreferences* prefs);

/*
 * account information functions.
 */
GgnAccount* ggn_preferences_account_new ();
void ggn_preferences_account_free (GgnAccount* account);
GSList* ggn_preferences_get_accounts (GgnPreferences* prefs);
GgnAccount* ggn_preferences_get_account (GgnPreferences* prefs,
                                         const gchar* email);
void ggn_preferences_set_account (GgnPreferences* prefs,
                                  GgnAccount* oldacct,
                                  GgnAccount* newacct);
void ggn_preferences_add_account (GgnPreferences* prefs,
                                  GgnAccount* account,
                                  gboolean signal);
void ggn_preferences_remove_account (GgnPreferences* prefs,
                                     GgnAccount* account,
                                     gboolean signal);

/*
 * parameter-get functions.
 */
gint ggn_preferences_get_rate (GgnPreferences* prefs);
gboolean ggn_preferences_get_notify_new (GgnPreferences* prefs);
gboolean ggn_preferences_get_notify_err (GgnPreferences* prefs);
gboolean ggn_preferences_get_sound_enab (GgnPreferences* prefs);
gchar* ggn_preferences_get_sound_file (GgnPreferences* prefs);
gboolean ggn_preferences_get_firstrun (GgnPreferences* prefs);

/*
 * parameter-set functions.
 */
void ggn_preferences_set_rate (GgnPreferences* prefs, gint value);
void ggn_preferences_set_notify_new (GgnPreferences* prefs,gboolean value);
void ggn_preferences_set_notify_err (GgnPreferences* prefs, gboolean value);
void ggn_preferences_set_sound_enab (GgnPreferences* prefs, gboolean value);
void ggn_preferences_set_sound_file (GgnPreferences* prefs,
                                     const gchar* value);
void ggn_preferences_set_firstrun (GgnPreferences* prefs, gboolean value);

/*
 * proxy information retrieval functions.
 */
gchar* ggn_preferences_get_proxy (GgnPreferences* prefs);
gchar* ggn_preferences_get_proxy_user (GgnPreferences* prefs);
gchar* ggn_preferences_get_proxy_pass (GgnPreferences* prefs);

/*
 * our header is at its end.
 */
G_END_DECLS

#endif /* __GNOME_GMAIL_NOTIFIER_PREFERENCES_H__ */

